using System;
using CustomerContactSystem.Core.Infrastructure.Domain;

namespace CustomerContactSystem.Core.Model {
    public class EnquiryCommitmentClosure : Entity {
        public virtual User MonitoredBy { get; set; }
        public virtual User AssignedTo { get; set; }
        public virtual DateTime Deadline { get; set; }
        public virtual bool Completed { get; set; }

        protected override void Validate() {
            if (MonitoredBy == null || MonitoredBy.Id == 0) {
                AddBrokenRule(new BusinessRule("MonitoredBy", "Monitored by is required!"));
            }

            if (AssignedTo == null || AssignedTo.Id == 0) {
                AddBrokenRule(new BusinessRule("AssignedTo", "Assigned to is required!"));
            }

            if (Deadline == DateTime.MinValue) {
                AddBrokenRule(new BusinessRule("Deadline", "Deadline is required!"));
            }
        }
    }
}